package com.jzr.board.controller.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jzr.board.db1.model.TDept;
import com.jzr.board.db1.service.TDeptService;
import com.jzr.common.entity.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Api(tags = "科室接口")
@RestController
@RequestMapping("/api/dept")
public class DeptController {
    @Autowired
    private TDeptService deptService;

    @ApiOperation("获取科室列表")
    @GetMapping("/codeList")
    public Result<List<Map<String,Object>>> codeList(){
        QueryWrapper<TDept> qw = new QueryWrapper<>();
        qw.select("code,name");
        qw.orderByAsc("name");
        List<Map<String,Object>> list = deptService.listMaps(qw);
        return Result.success("成功",list);
    }
}
